package com.wicket.okrframework.web.contorller;

import com.github.pagehelper.Page;
import com.wicket.okrframework.biz.service.NullService;
import com.wicket.okrframework.biz.service.dto.req.*;
import com.wicket.okrframework.biz.service.dto.res.*;
import com.wicket.okrframework.common.ro.OkrResult;
import com.wicket.okrframework.common.util.CommonFunctionHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ：
 * @date ：
 *
 *
 * @version 1.0
 */
@RestController
@RequestMapping("/base/null/")
public class NullController {

    @Autowired
    NullService nullService;

    /**
     * D1-2批量查询权限分配列表
     */
    @PostMapping("batchQueryTributPowerList")
    public OkrResult<BatchQueryTributPowerListRespDto> batchQueryTributPowerList(@RequestBody @Validated BatchQueryTributPowerListReqDto reqDTO) {
        return OkrResult.success(nullService.batchQueryTributPowerList(reqDTO));
    }

    /**
   * D1-3批量新增部门岗位职务关系
   */
    @PostMapping("batchAddDeptPosition")
    public OkrResult<BatchAddDeptPositionRespDto> batchAddDeptPosition(@RequestBody @Validated BatchAddDeptPositionReqDto reqDTO){
    return OkrResult.success(nullService.batchAddDeptPosition(reqDTO));
    }

    /**
     * D1-1查询内容对象与标签关系详情
     */
    @PostMapping("queryTagRelDetail")
    public OkrResult<QueryTagRelDetailRespDto> queryTagRelDetail(@RequestBody @Validated QueryTagRelDetailReqDto reqDTO) {
        return OkrResult.success(nullService.queryTagRelDetail(reqDTO));
    }

    /**
     * D1-1查询内容对象与标签关系列表
     */
    @PostMapping("queryTagRelList")
    public OkrResult<QueryTagRelListRespDto> queryTagRelList(@RequestBody @Validated QueryTagRelListReqDto reqDTO) {
        Page<?> page = CommonFunctionHelper.startPage(reqDTO.getPageNum(), reqDTO.getPageSize());

        QueryTagRelListRespDto retData = nullService.queryTagRelList(reqDTO);

        retData.setPageNum(page.getPageNum());
        retData.setPageSize(page.getPageSize());
        retData.setTotalNum(page.getTotal());
        return OkrResult.success(retData);

    }

    /**
     * D1-2删除自定义角色
     */
    @PostMapping("deleteRole")
    public OkrResult<DeleteRoleRespDto> deleteRole(@RequestBody @Validated DeleteRoleReqDto reqDTO) {
        return OkrResult.success(nullService.deleteRole(reqDTO));
    }

    /**
   * D1-3查询职位详情	
   */
    @PostMapping("queryPostDetail")
    public OkrResult<QueryPostDetailRespDto> queryPostDetail(@RequestBody @Validated QueryPostDetailReqDto reqDTO){
    return OkrResult.success(nullService.queryPostDetail(reqDTO));
    }
/**
   * D1-2批量查询个人资料列表
   */
    @PostMapping("batchQueryUserinfo")
    public OkrResult<BatchQueryUserinfoRespDto> batchQueryUserinfo(@RequestBody @Validated BatchQueryUserinfoReqDto reqDTO){
    return OkrResult.success(nullService.batchQueryUserinfo(reqDTO));
    }
}
